//
//  FYFMainViewCell.m
//  FYFPhotoBrowser
//
//  Created by fuyoufang on 16/5/14.
//  Copyright © 2016年 深圳－真二网. All rights reserved.
//

#import "FYFMainViewCell.h"
#import "Masonry.h"

@interface FYFMainViewCell ()

@property (nonatomic, weak) FYFImageGroupeView *imageGroupeView;

@end

@implementation FYFMainViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupSubviews];
    }
    return self;
}

- (void)setupSubviews {
    FYFImageGroupeView *imageGroupeView = [[FYFImageGroupeView alloc] init];
    imageGroupeView.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:imageGroupeView];
    self.imageGroupeView = imageGroupeView;
    
    [imageGroupeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(self.mas_width).multipliedBy(0.5);
        make.height.equalTo(self.mas_height);
        make.centerX.equalTo(self.mas_centerX);
        make.centerY.equalTo(self.mas_centerY);
    }];
}

+ (instancetype)mainViewCellWithTableView:(UITableView *)tableView {
    static NSString *ID = @"FYFMainViewCell";
    
    FYFMainViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[FYFMainViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];
    }
    return cell;
}

- (void)setImageInfos:(NSArray *)imageInfos {
    _imageInfos = imageInfos;
    self.imageGroupeView.imageInfos = imageInfos;
}



@end
